/*
 *   Copyright (c) 2010-2022, SIUFUNG
 */
package net.siufung.market.base.dict.controller.model.dicttype;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.extern.slf4j.Slf4j;
import net.siufung.core.model.AbstractDto;
import net.siufung.core.utils.CopyUtil;
import net.siufung.market.base.dict.mapper.entity.DictType;
import org.hibernate.validator.constraints.Length;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;

/**
 * <p>
 * 字典类型 修改数据传参对象
 * </p>
 * @author 陈建峰
 * @since 2022-07-08 15:30:16
 */
@Slf4j
@Data
@EqualsAndHashCode(callSuper = true)
@ApiModel(value="DictTypeUpdateDto", description="字典类型修改数据传输对象")
public class DictTypeUpdateDto extends AbstractDto {

    private static final long serialVersionUID = 6732268548303022412L;
    /**
     * 字典id
     */
    @ApiModelProperty(value = "字典id")
    @NotNull(message = "字典id不能为空!")
    private Integer id;

    /**
     * 字典类型名称
     */
    @ApiModelProperty(value = "字典类型名称")
    @NotBlank(message = "字典类型名称不能为空!")
    @Length(max=32, message="字典类型名称长度不大于32!")
    private String typeName;

    /**
     * 备注
     */
    @ApiModelProperty(value = "备注")
    @Length(max=64, message="备注长度不大于64!")
    private String description;

    /**
     * DictType 转化成 DictTypeSaveDto 数据领域实体
     * @return DictType
     */
    public DictType to(){
        DictType dictType = new DictType();
        CopyUtil.copyProperties(this, dictType);
        return dictType;
    }
}